#include <standard.hlsli>
//#include <WR2Parameters.hlsli>


struct VS_INPUT
{
    float4 Position : POSITION0;
    float3 Normal : NORMAL0;
    float2 Tex : TEXCOORD0;
};

struct VertexToPixel
{
    float4 pos : SV_POSITION;
    float4 texCoord1 : TEXCOORD0;
    float4 texCoord2 : TEXCOORD1;
    float4 texCoord3 : TEXCOORD2;
    float4 kBlend : COLOR0;
    float4 kColor : COLOR1;
    float4 pos2 : TEXCOORD5;
    float3 normal : TEXCOORD6;
    float foger : FOG;
};


VertexToPixel vs_main(VS_INPUT Input)
{
    VertexToPixel Output = (VertexToPixel) 0;
    Output.pos = float4(mul(Input.Position, worldViewProj));
    Output.normal = normalize(mul(Input.Normal, (float3x3) world));
    Output.pos2 = Input.Position;
    Output.texCoord2 = float4(Input.Position.x + Input.Position.y + Input.Position.z,
		Input.Position.x + Input.Position.y + Input.Position.z, 0, 0);

    return Output;
};

struct PixelToFrame
{
    float4 Color;
};

PixelToFrame ps_main(VertexToPixel PSIn) : SV_TARGET
{
    PixelToFrame Output = (PixelToFrame) 0;

    float4 TexColor = float4((PSIn.kBlend.rgb * 0.25f + materialColor.rgb * 0.7f), 1.0f);
    Output.Color = TexColor;

    if (paintHighLines)
    {
        if (abs(PSIn.pos2.y) % 100.0f > 0.9f && abs(PSIn.pos2.y) % 100.0f < 3.1f)
        {
            Output.Color.rgba = float4(1.0f, 0.0f, 0.0f, 0.5f);
        }
        else if (abs(PSIn.pos2.y) % 20.0f > 0.9f && abs(PSIn.pos2.y) % 20.0f < 3.1f)
        {
            Output.Color.rgba = float4(Output.Color.xyz * 1.5f, 0.50f);
        }
    }
    return Output;
}